import 'package:tender_flutter/page/supplier/model/supplier_detail_entity.dart';
import 'package:tender_flutter/page/supplier/model/certificate_entity.dart';

supplierDetailEntityFromJson(SupplierDetailEntity data, Map<String, dynamic> json) {
	if (json['companyLogo'] != null) {
		data.companyLogo = json['companyLogo'].toString();
	}
	if (json['licensePic'] != null) {
		data.licensePic = json['licensePic'].toString();
	}
	if (json['companyName'] != null) {
		data.companyName = json['companyName'].toString();
	}
	if (json['area'] != null) {
		data.area = json['area'].toString();
	}
	if (json['faRen'] != null) {
		data.faRen = json['faRen'].toString();
	}
	if (json['remark'] != null) {
		data.remark = json['remark'].toString();
	}
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	if (json['profiles'] != null) {
		data.profiles = new List<CertificateEntity>();
		(json['profiles'] as List).forEach((v) {
			data.profiles.add(new CertificateEntity().fromJson(v));
		});
	}
	if (json['type'] != null) {
		data.type = json['type'].toString();
	}
	if (json['labels'] != null) {
		data.labels = json['labels'].toString();
	}
	if (json['contact'] != null) {
		data.contact = json['contact'].toString();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['id'] != null) {
		data.id = json['id'].toString();
	}
	if (json['createDate'] != null) {
		data.createDate = json['createDate'].toString();
	}
	if (json['status'] != null) {
		data.status = json['status'].toString();
	}
	return data;
}

Map<String, dynamic> supplierDetailEntityToJson(SupplierDetailEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['companyLogo'] = entity.companyLogo;
	data['licensePic'] = entity.licensePic;
	data['companyName'] = entity.companyName;
	data['area'] = entity.area;
	data['faRen'] = entity.faRen;
	data['remark'] = entity.remark;
	data['title'] = entity.title;
	if (entity.profiles != null) {
		data['profiles'] =  entity.profiles.map((v) => v.toJson()).toList();
	}
	data['type'] = entity.type;
	data['labels'] = entity.labels;
	data['contact'] = entity.contact;
	data['name'] = entity.name;
	data['id'] = entity.id;
	data['createDate'] = entity.createDate;
	data['status'] = entity.status;
	return data;
}

supplierContactEntityFromJson(SupplierContactEntity data, Map<String, dynamic> json) {
	if (json['phone'] != null) {
		data.phone = json['phone'].toString();
	}
	if (json['wx'] != null) {
		data.wx = json['wx'].toString();
	}
	return data;
}

Map<String, dynamic> supplierContactEntityToJson(SupplierContactEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['phone'] = entity.phone;
	data['wx'] = entity.wx;
	return data;
}